<template>
  <div>
    <p>防抖节流</p>
    <el-button type="primary" @click="throttleBtn">节流</el-button>

    <el-button type="primary" @click="debounceBtn">防抖</el-button>
  </div>
</template>

<script setup lang="ts">
import { getCurrentInstance } from "vue";

const { proxy } = getCurrentInstance() as any;
console.log("proxy", proxy);

const test = () => {
  console.log("test");
};

const throttleBtn = () => {
  const throttleFn = proxy?.$throttle(test, 3000, "test");
  throttleFn();
};

const debounceBtn = () => {
  const debounceFn = proxy?.$debounce(test, 3000, "test");
  debounceFn();
};

proxy?.$globalFunc();
</script>
